package com.p7.framework.controller;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

@RestController
@RequestMapping("/validated")
@Validated
public class ValidatedController {
    @RequestMapping("/test")
    public Object test(@NotNull(message = "不能为null") String name) {
        return new Object();
    }

    @RequestMapping(method = RequestMethod.POST, value = "/analysisPhotograph")
    public Object analysisPhotograph(@NotBlank(message = "认证token不能为null") String token,
                                     @NotNull(message = "应用Id不能为null") Integer appId,
                                     @NotNull(message = "testType不能为null") @Range(message = "testType参数错误", min = 1, max = 2) Integer testType){

        System.out.println("------------------------------------");
        return new Object();
    }
}
